import {rolelist} from '../../../request/api'

// 封装一个接口类型
interface Statarole{
    roleList:Array<object>
}

const state = {
    roleList:[]
}

const getters = {
    getRole(state:Statarole){
        return state.roleList
    }
}

const mutations = {
    GETROLE(state:Statarole,payload:any){
        state.roleList = payload
    }
}

const actions = {
    async getRoleActions({commit}:any){
        let res = await rolelist()
        console.log(res);
        commit('GETROLE',res.list)
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}